home *** CD-ROM | disk | FTP | other *** search
- class Debris extends MovieClipHolder implements Steppable
- {
- var mc;
- var angle;
- var speed;
- var max_time;
- static var BASE_DECAY = 0.9;
- var timer = 0;
- function Debris(x, y, color, angle, speed, time)
- {
- super(_root.createEmptyMovieClip("debris" + _root.getNextHighestDepth(),_root.getNextHighestDepth()),_root.effects < 2 ? null : color,false,true);
- this.mc.lineStyle(2,color);
- var _loc4_ = new flash.geom.Point(CustomMath.randomRange(-5,0),CustomMath.randomRange(-2,2));
- this.mc.moveTo(_loc4_.x,_loc4_.y);
- this.mc.lineTo(CustomMath.randomRange(0,5),CustomMath.randomRange(2,6));
- this.mc.lineTo(CustomMath.randomRange(5,10),CustomMath.randomRange(-2,2));
- this.mc.lineTo(CustomMath.randomRange(0,5),CustomMath.randomRange(-2,-6));
- this.mc.lineTo(_loc4_.x,_loc4_.y);
- this.mc._alpha = 25;
- this.mc._x = x;
- this.mc._y = y;
- this.angle = angle;
- this.speed = speed;
- this.max_time = time;
- this.mc._rotation = Math.random() * 360;
- Stepper.add(this);
- }
- function step()
- {
- this.move();
- }
- function move()
- {
- if(this.speed > 0.1)
- {
- this.mc._rotation += this.speed;
- var _loc3_ = CustomMath.degToRad(this.angle);
- this.mc._x += this.speed * Math.cos(_loc3_);
- this.mc._y += this.speed * Math.sin(_loc3_);
- this.speed *= Debris.BASE_DECAY;
- }
- else
- {
- _root.debrisField.addDebris(this);
- this.die();
- }
- }
- function die()
- {
- this.mc.removeMovieClip();
- Stepper.remove(this);
- }
- }
-